
package com.ifcar.app.activity.topic;

import com.ifcar.app.util.ThemeSettingsHelper;
import com.ifcar.app.view.LoadingListView;
import com.ifcar.app.activity.R;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

public class AttitudeListViewFrament extends AttitudeFrament {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.pull_load_list_layout, container, false);
    }

    @Override
    public void onViewCreatedNR(View view, Bundle savedInstanceState) {
        super.onViewCreatedNR(view, savedInstanceState);

        LoadingListView loadingListView = (LoadingListView) view.findViewById(R.id.loading_list);

        LayoutInflater inflate = LayoutInflater.from(getActivity());
        View moreView = inflate.inflate(R.layout.more_layout, loadingListView.getListView(), false);
        loadingListView.setLoadingMoreView(moreView, R.id.show_more_button);

        attachLoadingListView(loadingListView);
    }

    @Override
    public void onApplyTheme() {
        super.onApplyTheme();
        ThemeSettingsHelper themeSettingsHelper = getThemeSettingsHelper();
        Context context = getActivity();
        LoadingListView loadingListView = getLoadingListView();
        themeSettingsHelper.setListViewDivider(context, loadingListView.getListView(),
                R.drawable.list_divider_line);
        Button moreButton = (Button) loadingListView.getLoadingMoreClickView();
        if (moreButton != null) {
            themeSettingsHelper
                    .setViewBackgroud(context, moreButton, R.drawable.netease_big_button);
            themeSettingsHelper.setTextViewColor(context, moreButton, R.color.list_title_color);
        }
    }

}
